@import '@influxdata/clockface/dist/variables.scss';

.data-source {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.data-source--controls {
  display: flex;
  align-items: flex-start;
  margin-bottom: $cf-space-2xs;
  flex-wrap: wrap;
  flex: 0 0 0;
}

.data-source--search {
  flex: 0 0 0;
}

.data-source--bucket {
  flex: 1 0 0;
  order: 1;
}

.data-source--aggregate {
  order: 2;
}

.data-source--filters {
  order: 3;
  flex: 1 0 100%;
  margin-top: $cf-space-3xs;
  display: flex;
  align-items: center;
}

.data-source--filters-label {
  height: $cf-form-sm-height;
  line-height: $cf-form-sm-height;
  font-weight: $cf-font-weight--medium;
  margin: 0;
  margin-right: $cf-space-2xs;
}

.data-source--filter {
  margin: $cf-border;

  & > .cf-label--name {
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.data-source--filters-list {
  display: flex;
  flex-wrap: wrap;
  flex: 1 0 0;
}

.data-source--block {
  display: block;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.data-source--block-results {
  display: flex;
  align-items: stretch;
  flex: 1 1 0;

  .cf-dapper-scrollbars {
    height: 100% !important;
  }
}

.data-source--block-title {
  font-size: 14px;
  user-select: none;
  font-weight: $cf-font-weight--medium;
  padding-bottom: $cf-space-2xs;
  margin-bottom: $cf-space-2xs;
  color: $cf-grey-75;
  border-bottom: $cf-border solid $cf-grey-15;
  text-transform: capitalize;
}

.data-source--list__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  color: $cf-grey-45;
  height: 304px;
}

.data-source--list__no-results {
  color: $cf-grey-45;
  justify-content: center;
  background-color: $cf-grey-5;
  border-radius: $cf-radius;

  > * {
    margin: $cf-space-3xs;
  }
}

/*
  Selectors
*/

.selectors--item-value {
  transition: color 0.25s ease;
  font-family: $cf-code-font;
}

.selectors--item-name {
  margin: 0 $cf-space-2xs;
}

.selectors--item-type {
  font-size: 0.75em;
  text-transform: uppercase;
  opacity: 0.666;
}

.selectors--item__measurement {
  color: #ff69b4;

  .cf-list-item:hover & {
    color: #ffb6c1;
  }
}

.selectors--item__field {
  color: #6495ed;

  .cf-list-item:hover & {
    color: #87cefa;
  }
}

.selectors--item__tag {
  color: #32cd32;

  .cf-list-item:hover & {
    color: #7cfc00;
  }
}

.data-source--agg-info {
  font-size: 13px;
  padding: $cf-space-2xs;
  user-select: none;
  color: $cf-grey-75;
  cursor: default;

  > p {
    margin: 0;
  }

  .cf-icon {
    display: inline-block;
    margin-right: $cf-space-3xs;
    line-height: 1em;
  }
}

// Responsive Layout
// The 1200px number is somewhat arbitrary but works with the current design
// Adjust as needed
@media screen and (min-width: 1200px) {
  .data-source--controls {
    flex-wrap: nowrap;
  }

  .data-source--bucket {
    flex: initial;
  }

  .data-source--filters-label {
    margin-left: $cf-space-2xs;
  }

  .data-source--aggregate {
    order: 3;
  }

  .data-source--filters {
    order: 2;
    flex: 1 0 100px;
    margin-top: 0;
    margin-right: $cf-space-3xs;
  }
}
